﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Administracija.master" AutoEventWireup="true" CodeFile="AdministracijaRasadnika.aspx.cs" Inherits="AdministracijaRasadnika" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link href="Stilovi/AdministracijaRasadnika.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <div id="administracijaMeni">
                 <ul class="meni_lista">
                    <li><a href="Administracija.aspx">Administracija naslovna</a></li>
                    <li><a href="AdministracijaClanaka.aspx">Administracija članaka</a></li>
                    <li><a href="AdministracijaDrveca.aspx">Administracija drveća</a></li>
                    <li><a href="AdministracijaSlika.aspx">Administracija slika</a></li>
                 </ul>
     </div>

     <div id="glavni">
         <asp:SqlDataSource ID="sdsRasadnici" runat="server" 
             ConnectionString="<%$ ConnectionStrings:EnciklopedijaDrvecaConnectionString %>" 
             DeleteCommand="DELETE FROM [Rasadnik] WHERE [RasadnikID] = @RasadnikID" 
             InsertCommand="INSERT INTO [Rasadnik] ([RasadnikID], [NazivRasadnika], [Opis], [Adresa], [Link]) VALUES (@RasadnikID, @NazivRasadnika, @Opis, @Adresa, @Link)" 
             SelectCommand="SELECT * FROM [Rasadnik]" 
             UpdateCommand="UPDATE [Rasadnik] SET [NazivRasadnika] = @NazivRasadnika, [Opis] = @Opis, [Adresa] = @Adresa, [Link] = @Link WHERE [RasadnikID] = @RasadnikID">
             <DeleteParameters>
                 <asp:Parameter Name="RasadnikID" Type="Int32" />
             </DeleteParameters>
             <InsertParameters>
                 <asp:Parameter Name="RasadnikID" Type="Int32" />
                 <asp:Parameter Name="NazivRasadnika" Type="String" />
                 <asp:Parameter Name="Opis" Type="String" />
                 <asp:Parameter Name="Adresa" Type="String" />
                 <asp:Parameter Name="Link" Type="String" />
             </InsertParameters>
             <UpdateParameters>
                 <asp:Parameter Name="NazivRasadnika" Type="String" />
                 <asp:Parameter Name="Opis" Type="String" />
                 <asp:Parameter Name="Adresa" Type="String" />
                 <asp:Parameter Name="Link" Type="String" />
                 <asp:Parameter Name="RasadnikID" Type="Int32" />
             </UpdateParameters>
         </asp:SqlDataSource>
         <h2>Popis rasadnika</h2>
         <div id="tablica">
         <asp:GridView ID="grdRasadnici" runat="server" AllowPaging="True" 
             AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="RasadnikID" 
             DataSourceID="sdsRasadnici" BackColor="#000066" CellPadding="10" 
                 ForeColor="White" >
             <AlternatingRowStyle BackColor="#000099" />
             <Columns>
                 <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                     ShowSelectButton="True" CancelText="Odustani" DeleteText="Briši" 
                     EditText="Uredi" InsertText="Dodaj" NewText="Novo" SelectText="Odaberi" 
                     UpdateText="Potvrdi" >
                 <ItemStyle Font-Bold="True" />
                 </asp:CommandField>
                 <asp:BoundField DataField="RasadnikID" HeaderText="Id rasadnika" ReadOnly="True" 
                     SortExpression="RasadnikID" />
                 <asp:BoundField DataField="NazivRasadnika" HeaderText="Naziv rasadnika" 
                     SortExpression="NazivRasadnika" />
                 <asp:BoundField DataField="Opis" HeaderText="Opis" SortExpression="Opis" />
                 <asp:BoundField DataField="Adresa" HeaderText="Adresa" 
                     SortExpression="Adresa" />
                 <asp:BoundField DataField="Link" HeaderText="Link" SortExpression="Link" />
             </Columns>
             <HeaderStyle BackColor="Black" />
             <SelectedRowStyle BackColor="#006600" />
         </asp:GridView>
         <asp:SqlDataSource ID="sdsDetaljiRasadnici" runat="server" 
             ConnectionString="<%$ ConnectionStrings:EnciklopedijaDrvecaConnectionString %>" 
             DeleteCommand="DELETE FROM [Rasadnik] WHERE [RasadnikID] = @RasadnikID" 
             InsertCommand="INSERT INTO [Rasadnik] ([NazivRasadnika], [Opis], [Adresa], [Link], [Telefon]) VALUES (@NazivRasadnika, @Opis, @Adresa, @Link, @Telefon)" 
             SelectCommand="SELECT * FROM [Rasadnik] WHERE ([RasadnikID] = @RasadnikID2)" 
             UpdateCommand="UPDATE [Rasadnik] SET [NazivRasadnika] = @NazivRasadnika, [Opis] = @Opis, [Adresa] = @Adresa, [Link] = @Link, [Telefon] = @Telefon WHERE [RasadnikID] = @RasadnikID">
             <DeleteParameters>
                 <asp:Parameter Name="RasadnikID" Type="Int32" />
             </DeleteParameters>
             <InsertParameters>
                 <asp:Parameter Name="NazivRasadnika" Type="String" />
                 <asp:Parameter Name="Opis" Type="String" />
                 <asp:Parameter Name="Adresa" Type="String" />
                 <asp:Parameter Name="Link" Type="String" />
                 <asp:Parameter Name="Telefon" Type="String" />
             </InsertParameters>
             <SelectParameters>
                 <asp:ControlParameter ControlID="grdRasadnici" DefaultValue="1" 
                     Name="RasadnikID2" PropertyName="SelectedValue" Type="Int32" />
             </SelectParameters>
             <UpdateParameters>
                 <asp:Parameter Name="NazivRasadnika" Type="String" />
                 <asp:Parameter Name="Opis" Type="String" />
                 <asp:Parameter Name="Adresa" Type="String" />
                 <asp:Parameter Name="Link" Type="String" />
                 <asp:Parameter Name="Telefon" Type="String" />
                 <asp:Parameter Name="RasadnikID" Type="Int32" />
             </UpdateParameters>
         </asp:SqlDataSource>
         </div>
         <h2>Detalji</h2>
         <div id="detalji">
         <asp:DetailsView ID="detailsRasadnici" runat="server" Height="50px" 
             Width="125px" AutoGenerateRows="False" AllowPaging="True" 
             DataKeyNames="RasadnikID" DataSourceID="sdsDetaljiRasadnici" 
             oniteminserted="detailsRasadnici_ItemInserted" BackColor="#000099" 
                 CellPadding="10" ForeColor="White">
             <Fields>
                 <asp:BoundField DataField="RasadnikID" HeaderText="Id rasadnika" 
                     InsertVisible="False" ReadOnly="True" SortExpression="RasadnikID" />
                 <asp:BoundField DataField="NazivRasadnika" HeaderText="Naziv rasadnika" 
                     SortExpression="NazivRasadnika" />
                 <asp:BoundField DataField="Opis" HeaderText="Opis" SortExpression="Opis" />
                 <asp:BoundField DataField="Adresa" HeaderText="Adresa" 
                     SortExpression="Adresa" />
                 <asp:BoundField DataField="Link" HeaderText="Link" SortExpression="Link" />
                 <asp:BoundField DataField="Telefon" HeaderText="Telefon" 
                     SortExpression="Telefon" />
                 <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                     ShowInsertButton="True" CancelText="Odustani" DeleteText="Briši" 
                     EditText="Uredi" InsertText="Dodaj" NewText="Novo" SelectText="Odaberi" 
                     UpdateText="Potvrdi" >
                 <ItemStyle Font-Bold="True" />
                 </asp:CommandField>
             </Fields>
         </asp:DetailsView>
         </div>
     </div>
</asp:Content>

